import request from '/@/utils/request';
const headers = {
	// onlyData: true,
};

//审核
export function declareApprove(data?: any) {
	return request({
		url: `/manage/app/declare/approve`,
		method: 'post',
		headers,
		data,
	});
}
//审核新-详情页-当前实例能否回退
export const processRecordExecute = (instanceId?: string, taskId?: string, nodeId?: string) => {
	return request({
		url: `/manage/process/record/back/execute/${instanceId}/${taskId}/${nodeId}`,
		method: 'post',
		headers,
	});
};
//审核旧分页查询
export const declarePage = (query?: Object) => {
	return request({
		url: `/manage/app/declare/page`,
		method: 'get',
		headers,
		params: query,
	});
};
//审核新-详情页-当前实例能否回退
export const processRecordBack = (instanceId?: string, taskId?: string, nodeId?: string) => {
	return request({
		url: `/manage/process/record/back/${instanceId}/${taskId}/${nodeId}`,
		method: 'get',
		headers,
	});
};
//审核新-分页查询
export const declareVerifyPage = (data?: any) => {
	if (data.timeArr) {
		data['startTime'] = data.timeArr[0];
		data['endTime'] = data.timeArr[1];
		delete data.timeArr;
	}
	return request({
		url: `/manage/app/declare/verify/page`,
		method: 'post',
		headers,
		data,
	});
};
//列表删除
export function declareDelete(appCode: string) {
	return request({
		url: `/manage/app/declare/delete/${appCode}`,
		method: 'delete',
		headers,
	});
}
//列表撤销
export function declareCancel(instanceId: string) {
	return request({
		url: `/manage/app/declare/cancel/${instanceId}`,
		method: 'post',
		headers,
	});
}
//申报
export const declareSubmit = (data?: any) => {
	return request({
		url: `/manage/app/declare/submit`,
		method: 'post',
		headers,
		data,
	});
};
//保存
export const declareSave = (data?: any) => {
	return request({
		url: `/manage/app/declare/save`,
		method: 'post',
		headers,
		data,
	});
};

//历史记录详情
export const recordsDetailApi = (params: any) => {
	return request({
		url: `/manage/historyVersion/getDetailById`,
		method: 'get',
		params,
	});
};
